zhouqijie

3D纹理

3D纹理不能从图像文件构建,而是程序生成的,通常由数组存储。

创建3维纹理对象:

GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_3D, textureID);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexStorage3D(GL_TEXTURE_3D, 1, GL_RGBA8, texWidth, texHeight, texDepth);
glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, texWidth, texHeight, texDepth, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
return textureID;

噪声

噪声种类:

噪声纹理应用:

  1. 生成云幕。(编写Logistic函数)
  2. 不均匀的雾。
  3. 水波效果。
  4. 消融效果。